/**
* @author Meng Zhang
**/

#pragma once
#include "../ScintillaCtrl/ScintillaCtrl.h"
#include "../ConfigInfo/Config.h"

class TextBuffer;
class CTextBufferView;

//#define MARGIN_SCRIPT_FOLD_INDEX 1

class CCodeEdit : public CScintillaCtrl
{
private:
	ConfigInfo info;
	std::vector<std::string> wordList, userList;
	virtual void InitalizeWithConfigInfo();

public:
	CCodeEdit(void);
	virtual ~CCodeEdit(void);
	virtual void Initialize(const TextBuffer& buffer);
	virtual void RecalcLineMargin();
	void CharAdded(char ch);
	void StartAutoComplete();
	void StartAutoCompleteField();
	void StartAutoIndent(char ch);
	void BraceComplete(char ch);
	void LineIndentation(int line , int indent);
	int GetCaretInLine();
	//std::string GetNearestWords(const std::string &pre);
	void AddWords(const KeyWords& k);
	CTextBufferView* GetView();
	TextBuffer* GetTextBuffer();
	//TODO(Meng Zhang)

// 	int GetLineLength(int line);
// 	int GetCurrentLineNumber();
};
